<template>
  <h1>表单组件</h1>
  <el-form style="width: 500px;margin: 0 auto;" label-width="80">
    <el-form-item label="用户名">
      <el-input type="text" placeholder="请输入用户名" v-model="user.name"></el-input>
    </el-form-item>
    <el-form-item label="密码">
      <el-input show-password placeholder="请输入密码" v-model="user.pas"></el-input>
    </el-form-item>
    <el-form-item label="性别">
      <el-radio-group v-model="user.gender">
        <el-radio label="男" value="1"></el-radio>
        <el-radio label="女" value="0"></el-radio>
      </el-radio-group>
    </el-form-item>
    <el-form-item label="所在地">
      <el-select v-model="user.local" placeholder="请选择城市">
        <el-option label="北京" value="bj"></el-option>
        <el-option label="北京1" value="bj1"></el-option>
        <el-option label="北京2" value="bj2"></el-option>
        <el-option label="北京3" value="bj3"></el-option>
        <el-option label="北京4" value="bj4"></el-option>
      </el-select>
    </el-form-item>
    <el-form-item label="管理员">
      <el-switch :active-value="1" :inactive-value="0" v-model="user.isAdmin">
      </el-switch>
    </el-form-item>
    <el-button type="success" @click="submit()">点我提交</el-button>
  </el-form>
</template>

<script setup>
import {ref} from "vue";

const user=ref({
  name:'',
  pas:'',
  gender:'',
  local:'',
  isAdmin: 1
});
const submit=()=>{

  console.log(user.value);
}
</script>

<style scoped>

</style>